import React from 'react';
import {Input,InputNumber,Button,Icon,Modal,Form,Message} from 'antd';
import {hashHistory} from 'react-router';
// import fund from './fund.css'
const createForm = Form.create;
let accountGetCash = React.createClass({
    getInitialState(){
      return{
        visible:false,
      }
    },
    goToSee(){
      hashHistory.push('/');
    },
    submitGET(){
      let params = this.props.form.getFieldsValue();
      console.log(params);
      Utils.sendAjax({
        url:'cash/user/apply',
        data:JSON.stringify(params),
        callback:function(result){
          if(result.code == '200'){
            Message.success(result.message);
            Modal.success({
              title:'提交成功',
              content:'爱租派已收到您的提现申请,我们会于3-5个工作日内处理,请关注您的提现记录！',
              okText:'查看申请记录',
              onOk:function(){
                hashHistory.push('/system/cashIndex');
              },
              maskClosable:true
            });
          }else if(result.code == '400'){
               Message.error(result.message);
          }else if(result.code == '404'){
            Message.error(result.message);
          }else if(result.code == '500'){
            Message.error("提现金额不能为空");
          }
        }
      });
    },
    back(){
      history.back();
    },
    render(){
      const FormItem = Form.Item;
      const { getFieldProps } = this.props.form;
      return (
        <div>
          <div className='resetPwd'>
            <Form style={{paddingTop:'2.0rem',paddingBottom:'20.0rem',marginLeft: '7%'}}>
            {
              <ul>
                     <li>
                          <label>提现账户</label><font className='Cash-font'>基础账户</font>
                     </li>
                     <li><label className="fl ant-form-item">申请提现金额</label>
                        <FormItem  className="fr"  label="">
                            <Input type='number'  {...getFieldProps('amount')}   placeholder='如：2000.0' />
                        </FormItem>
                    </li>
                     <li><label className="fl ant-form-item">开户人</label>
                        <FormItem  className="fr"  label="">
                            <Input  {...getFieldProps('bankUser')} placeholder='如：张三' />
                        </FormItem>
                    </li>
                      <li><label className="fl ant-form-item">开户行</label>
                        <FormItem  className="fr"  label="">
                            <Input  {...getFieldProps('bankBranch')} placeholder='如：农业银行萧山分行' />
                        </FormItem>
                    </li>
                    <li><label className="fl ant-form-item">开户卡号</label>
                        <FormItem  className="fr"  label="">
                            <Input type='number' {...getFieldProps('bankNo')} placeholder='如：621333322285552' />
                        </FormItem>
                    </li>
                    <li><label className="fl ant-form-item">登录密码</label>
                        <FormItem className="fr" label="">
                            <Input type="password"  {...getFieldProps('password')} placeholder="8-16位数字、字母、特殊字符组成" />
                        </FormItem>
                     </li>
                    <li>
                        <span className="fl ant-form-item"></span>
                        <FormItem className="fr" label="">
                          <Button type='link' onClick={this.submitGET}>立即提现</Button>
                          <Button type='link' onClick={this.back}>返 回</Button>
                        </FormItem>
                    </li>
                </ul>
            }
            </Form>
          </div>
          <div className='getCash-tips'>
             <font>温馨提示：</font>
             <div><Icon type='exclamation-circle-o'/><font>提交申请后，爱租派会于3-5个工作日内处理您的提现申请,请关注您的提现记录</font></div>
              <div><Icon type='exclamation-circle-o'/><font>基础账户内余额可提现，增值账户内余额不可提现</font></div>
             <div><Icon type='exclamation-circle-o'/><font>提现手续每笔2元</font></div>
          </div>
        </div>
      )
    }
});
accountGetCash = createForm()(accountGetCash);
export default accountGetCash;
